1. Field
The present invention relates to the parsing of XML and name-value pair (NVP) data in a computer system, and more particularly to the parsing of XML and NVP data in software on CPU's with multiple execution units.
2. Related Art
eXtensible Mark-up Language (XML) is a simple, easy, and open data protocol that describes content, and is often used for web services. However, XML is a verbose language for data, with space requests often two to twenty times the size of the underlying binary data. One of its main limitations is that the parsing of XML data in software requires significant resources, several times more than many other types of data. Processing resources can be scarce, particularly in systems such as handheld devices or mobile phones. Servers also may have limited resources and/or time constraints for XML parsing.
Some prior art approaches to XML data parsing is to perform the parsing using hardware, or more specifically, application specific integrated circuits (ASIC). Although XML data parsing using hardware provides the advantage of speed, this approach in inflexible. Changes to the parsing process would require replacing or upgrading the ASIC, which can require a significant amount of time. Thus, parsing XML in software can be preferable.
Prior art methods of parsing XML in software perform the following processing loops in a sequential manner: (1) scanning for delimiter(s); (2) copying characters of a string into a buffer; (3) checking the characters of the string for well-formedness; (4) calculating a hash value for the string; (5) copying the string to a hash table; and (6) copying the string to an output stream. The sequential nature of these loops requires a significant number of cycles, causing delay in finishing a task.
Name-value pairs (NVP) format is another common protocol with which to transmit data and describe content, though frequently not as verbose as XML. As simple as this format is, it can still require significant Central Processing Unit (CPU) cycles to parse NVP data.
As with XML, prior art methods of parsing NVP data in software perform the following processing loops in a sequential manner: (1) scanning for delimiter(s); (2) copying characters of a string into a buffer; (3) checking the characters of the string for well-formedness; (3) calculating a hash value for the string; (4) copying the string to a hash table; and (5) copying the string to an output stream. The sequential nature of these loops requires a significant number of cycles, causing delay in finishing a task.
Accordingly, there exists a need for a method for improving the efficiency of parsing XML data or NVP data in software. The present invention addresses such a need.